<template>
	<view class="u-page">
		<view v-for="(item, index) in indexList"
				:key="index">
				<u-cell
								:title="`列表长度-${index + 1}`"
							>
								<u-avatar
									slot="icon"
									shape="square"
									size="35"
									:src="item.url"
									customStyle="margin: -3px 5px -3px 0"
								></u-avatar>
			</u-cell>
		</view>
		<u-loadmore @loadmore="loadmore" />
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indexList: [],
				urls: [
					'https://cdn.uviewui.com/uview/album/1.jpg',
					'https://cdn.uviewui.com/uview/album/2.jpg',
					'https://cdn.uviewui.com/uview/album/3.jpg',
					'https://cdn.uviewui.com/uview/album/4.jpg',
					'https://cdn.uviewui.com/uview/album/5.jpg',
					'https://cdn.uviewui.com/uview/album/6.jpg',
					'https://cdn.uviewui.com/uview/album/7.jpg',
					'https://cdn.uviewui.com/uview/album/8.jpg',
					'https://cdn.uviewui.com/uview/album/9.jpg',
					'https://cdn.uviewui.com/uview/album/10.jpg',
				],
				page:1
			}
		},
		onPullDownRefresh(){
			console.log(1111);
			this.loadmore();
		},
		onReachBottom(){
			console.log(22222);
			this.loadmore()
		},
		onPageScroll(){
			console.log(333);
		},
		
		onLoad() {
			this.loadmore()
		},
		methods: {
			scrolltolower() {
				this.loadmore()
			},
			loadmore() {
				this.page++
				for (let i = 0; i < 10; i++) {
					console.log(i);
					this.indexList.unshift({
						url: this.urls[uni.$u.random(0, this.urls.length - 1)]
					})
				}
			}
		},
	}
</script>